<?php

namespace Plugins\Edge\Common\Enums;

use App\Common\Enums\EnumStatusTrait;
use Sc\Util\HtmlElement\ElementType\AbstractHtmlElement;

/**
 * 新闻资讯 : 状态
 */
enum NewsEnumStatus :int
{
    use EnumStatusTrait;

    /**
    * 下架
    */
    case OffTheShelf = 0;

    /**
    * 上架
    */
    case Listing = 1;

    /**
     * 获取描述
     *
     * @return string
     */
    public function getDes(): string
    {
        return match ($this) {
            self::OffTheShelf => '下架',
            self::Listing     => '上架',
        };
    }

    /**
     * 转标签
     */
    public function toTag():AbstractHtmlElement
    {
        return match ($this){
            self::OffTheShelf => $this->getTag('success', 'light'),
            self::Listing     => $this->getTag('warning', 'light'),
        };
    }
}
